package com.fw.system.web.service.impl;

import com.fw.common.Builder;
import com.fw.common.IdXD;
import com.fw.system.web.dao.TbGunsLogMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fw.system.web.model.entity.TbGunsLog;
import com.fw.system.web.service.ITbGunsLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 装备购买出售记录表 服务实现类
 * </p>
 *
 * @author
 * @since 2021-11-24
 */
@Service
public class TbGunsLogServiceImpl extends ServiceImpl<TbGunsLogMapper, TbGunsLog> implements ITbGunsLogService {

    @Autowired
    private IdXD idXD;


    @Override
    public void gunsBuyLog(String userId, String gunsId, BigDecimal amount, Integer isType) {
        Builder.of(TbGunsLog::new)
                .with(TbGunsLog::setId,idXD.nextId())
                .with(TbGunsLog::setAmount,amount)
                .with(TbGunsLog::setCreateTime, LocalDateTime.now())
                .with(TbGunsLog::setGunsId,gunsId)
                .with(TbGunsLog::setUserId,userId)
                .with(TbGunsLog::setIsType,isType).build().insert();
    }
}
